﻿@using HrEFCore
@model ER
<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<!-- 引入样式 -->
	<script src="~/aa/element-ui/lib/index.js"></script>
	<!-- 引入组件库 -->
	<link href="~/aa/element-ui/lib/theme-chalk/index.css" rel="stylesheet" />
	<script src="~/aa/jquery-3.4.1.js"></script>
	<script src="~/aa/jquery.validate.js"></script>
	<script src="~/aa/jquery.validate.unobtrusive.js"></script>
	<script src="~/aa/vue/dist/vue.js"></script>
	<script src="~/aa/element-ui/lib/index.js"></script>
	<link href="~/aa/element-ui/lib/theme-chalk/index.css" rel="stylesheet" />
	<script src="~/aa/axios/dist/axios.js"></script>
	<link rel="stylesheet" href="~/css/table.css" type="text/css"></link>
	<script type="text/javascript" src="~/javascript/comm/comm.js"></script>
	<script type="text/javascript" src="~/javascript/jquery-1.7.2.js"></script>
	<style type="text/css">
		.s {
			color: red;
		}
	</style>
	<style type="text/css">
		body {
			background: rgb(253,244,227);
		}

		.TD_STYLE1 {
			background: #E6DDCE;
			/* color:white; */
		}

		.TD_STYLE2 {
			background: rgb(253,244,227);
		}

		.INPUT_STYLE2 {
			background: rgb(253,244,227);
		}
	</style>
	@* 日期每过一秒更新一次 *@
	<script>
		setInterval(() => {
			var now = new Date();
			document.getElementsByName("RegistTime")[0].value = now.getFullYear() + "-" +
				(now.getMonth() + 1).toString().padStart(2, "0") + "-" +
				now.getDate().toString().padStart(2, "0") + " " +
				now.getHours().toString().padStart(2, "0") + ":" +
				now.getMinutes().toString().padStart(2, "0") + ":" +
				now.getSeconds().toString().padStart(2, "0");
		}, 1000);
	</script>

</head>
<body>
	<form action="/ER/Add" method="post" id="hfAdd">
		<table style="width:100%;margin-top:10px;height:30px;background-color:rgb(253,244,227)">
			<tr>
				<td>
					<font color="black">
						您正在做的业务是：人力资源--招聘管理--简历管理--简历登记
					</font>
				</td>
			</tr>
			<tr>
				<td style="float:right;margin-bottom:10px;margin-right:20px">
					<input type="submit" value="提交" class="BUTTON_STYLE1" />
					<input type="reset" value="清除" class="BUTTON_STYLE1" />
				</td>
			</tr>
		</table>
		<table width="100%" border="1" cellpadding=3 cellspacing=1
			   bordercolorlight=#848284 bordercolordark=#eeeeee
			   class="TABLE_STYLE1 table-bordered">

			<tr>
				<td class="TD_STYLE1">
					@* 职位分类 *@
					@Html.LabelFor(e=>e.HumanMajorKindName)
				</td>
				<td class="TD_STYLE2">
					@* @Html.DropDownListFor(e=>e.HumanMajorKindId,ViewBag.cmk as IEnumerable<SelectListItem>,new{@class="form-control"}) *@
					@* <select id="HumanMajorKindId" name="HumanMajorKindId" v-model="HumanMajorKindId" v-on:change="getName" class="form-control">
						@foreach (var item in ViewBag.cmk as IEnumerable<SelectListItem>)
						{
							<option value="@item.Value">@item.Text</option>
						}
					</select> *@
					<input type="text" class="form-control" id="HumanMajorKindName" name="HumanMajorKindName" v-model="kindname"/>
					<input type="text" class="form-control" id="HumanMajorKindId" name="HumanMajorKindId" v-model="kindid" style="display:none"/>
				</td>
				<td class="TD_STYLE1" width="5%">
					@* 职位名称 *@
					@Html.LabelFor(e=>e.HunmaMajorName)
				</td>
				<td class="TD_STYLE2" width="200px">
					@* @Html.DropDownListFor(e=>e.HumanMajorId,ViewBag.cm as IEnumerable<SelectListItem>,new{@class="form-control"}) *@
					@* <select id="HumanMajorId" name="HumanMajorId" class="form-control">
						<option v-for="item in MajorName" :value="item.majorId">{{item.majorName}}</option>
					</select> *@
					<input type="text" class="form-control" id="HumanMajorId" name="HumanMajorId" v-model="majorid" style="display:none"/>
					<input type="text" class="form-control" id="HunmaMajorName" name="HunmaMajorName" v-model="majorname" />
				</td>
				<td width="11%" class="TD_STYLE1">
					@* 招聘类型 *@
					@Html.LabelFor(e=>e.EngageType)
				</td>
				<td class="TD_STYLE2" colspan="2">
					<select name="EngageType" class="form-control">
						<option value="社会招聘" selected="selected">
							社会招聘
						</option>
						<option value="校园招聘">
							校园招聘
						</option>
						<option value="兼职招聘">
							兼职招聘
						</option>
						<option value="临时招聘">
							临时招聘
						</option>
					</select>
				</td>
				<td rowspan="4">
					<el-upload class="avatar-uploader"
							   action="/ER/WJSC"
							   :show-file-list="false"
							   :on-success="handleAvatarSuccess"
							   :before-upload="beforeAvatarUpload">
						<img v-if="imageUrl" :src="imageUrl" class="avatar" style="width:150px;height:150px">
						<i v-else class="el-icon-plus avatar-uploader-icon"></i>
					</el-upload>
				</td>
			</tr>
			<tr>
				<td class="TD_STYLE1">
					@* 姓名 *@
					@Html.LabelFor(e=>e.HumanName)
				</td>
				<td class="TD_STYLE2">
					@Html.TextBoxFor(e=>e.HumanName,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanName)</span>
				</td>
				<td class="TD_STYLE1">
					@* 性别 *@
					@Html.LabelFor(e=>e.HumanSex)
				</td>
				<td class="TD_STYLE2">
					<select name="HumanSex" class="form-control" v-model="gender">
						<option value="男">
							男
						</option>
						<option value="女">
							女
						</option>
					</select>
				</td>
				<td class="TD_STYLE1">
					@* EMAIL *@
					@Html.LabelFor(e=>e.HumanEmail)
				</td>
				<td colspan="2" class="TD_STYLE2">
					@Html.TextBoxFor(e=>e.HumanEmail,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanEmail)</span>
				</td>
			</tr>
			<tr>
				<td class="TD_STYLE1">
					@* 电话 *@
					@Html.LabelFor(e=>e.HumanTelephone)
				</td>
				<td class="TD_STYLE2">
					@Html.TextBoxFor(e=>e.HumanTelephone,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanTelephone)</span>
				</td>
				<td class="TD_STYLE1">
					@* 家庭电话 *@
					@Html.LabelFor(e=>e.HumanHomephone)
				</td>
				<td class="TD_STYLE2">
					@Html.TextBoxFor(e=>e.HumanHomephone,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanHomephone)</span>
				</td>
				<td class="TD_STYLE1">
					@* 手机 *@
					@Html.LabelFor(e=>e.HumanMobilephone)
				</td>
				<td colspan="2" class="TD_STYLE2">
					@Html.TextBoxFor(e=>e.HumanMobilephone,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanMobilephone)</span>
				</td>
			</tr>
			<tr>
				<td class="TD_STYLE1">
					@* 住址 *@
					@Html.LabelFor(e=>e.HumanAddress)
				</td>
				<td colspan="3" class="TD_STYLE2">
					@* <input type="text" name="HumanAddress" class="form-control"> *@
					@Html.TextBoxFor(e=>e.HumanAddress,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanAddress)</span>
				</td>
				<td class="TD_STYLE1">
					@* 邮编 *@
					@Html.LabelFor(e=>e.HumanPostcode)
				</td>
				<td colspan="2" class="TD_STYLE2">
					@Html.TextBoxFor(e=>e.HumanPostcode,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanPostcode)</span>
				</td>
			</tr>
			<tr>
				<td class="TD_STYLE1">
					@* 国籍 *@
					@Html.LabelFor(e=>e.HumanNationality)
				</td>
				<td class="TD_STYLE2">
					@Html.DropDownListFor(e=>e.HumanNationality,ViewBag.gj as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>
				<td class="TD_STYLE1">
					@* 出生地 *@
					@Html.LabelFor(e=>e.HumanBirthplace)
				</td>
				<td class="TD_STYLE2">
					@Html.TextBoxFor(e=>e.HumanBirthplace,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanBirthplace)</span>
				</td>
				<td class="TD_STYLE1">
					@* 生日 *@
					@Html.LabelFor(e=>e.HumanBirthday)
				</td>
				<td width="18%" class="TD_STYLE2">
					<input type="text" v-model="birthday" class="form-control" name="HumanBirthday" />
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanBirthday)</span>
				</td>

			</tr>
			<tr>
				<td width="9%" class="TD_STYLE1">
					@* 民族 *@
					@Html.LabelFor(e=>e.HumanRace)
				</td>
				<td class="TD_STYLE2" width="14%">
					@Html.DropDownListFor(e=>e.HumanRace,ViewBag.mz as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>
				<td class="TD_STYLE1">
					@* 宗教信仰 *@
					@Html.LabelFor(e=>e.HumanReligion)
				</td>
				<td class="TD_STYLE2">
					@Html.DropDownListFor(e=>e.HumanReligion,ViewBag.zjxy as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>
				<td class="TD_STYLE1">
					@* 政治面貌 *@
					@Html.LabelFor(e=>e.HumanParty)
				</td>
				<td class="TD_STYLE2">
					@Html.DropDownListFor(e=>e.HumanParty,ViewBag.zzmm as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>
				<td class="TD_STYLE1">
					薪酬标准
				</td>
				<td class="TD_STYLE2">
					<input type="text" class="form-control" name="DemandSalaryStandard" v-model="money" readonly="readonly"/>
				</td>
			</tr>
			<tr>

				<td class="TD_STYLE1">
					@* 身份证号码 *@
					@Html.LabelFor(e=>e.HumanIdcard)
				</td>
				<td class="TD_STYLE2">
					@* @Html.TextBoxFor(e=>e.HumanIdcard,new{@class="form-control"}) *@
					<input type="text" v-model="idCard" v-on:blur="parseIdCard" name="HumanIdcard" class="form-control" />

					<span class="s">@Html.ValidationMessageFor(e=>e.HumanIdcard)</span>
				</td>
				<td class="TD_STYLE1">
					@* 年龄 *@
					@Html.LabelFor(e=>e.HumanAge)
				</td>
				<td class="TD_STYLE2">
					@* @Html.TextBoxFor(e=>e.HumanAge,new{@class="form-control"}) *@
					<input type="text" v-model="age" class="form-control" name="HumanAge" />

					<span class="s">@Html.ValidationMessageFor(e=>e.HumanAge)</span>
				</td>
				<td class="TD_STYLE1">
					@* 毕业院校 HumanCollege *@
					@Html.LabelFor(e=>e.HumanCollege)
				</td>
				<td class="TD_STYLE2">
					@Html.TextBoxFor(e=>e.HumanCollege,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanCollege)</span>
				</td>
				<td class="TD_STYLE1">
					@* 学历 *@
					@Html.LabelFor(e=>e.HumanEducatedDegree)
				</td>
				<td class="TD_STYLE2">
					@Html.DropDownListFor(e=>e.HumanEducatedDegree,ViewBag.xl as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>

			</tr>
			<tr>
				<td class="TD_STYLE1">
					@* 教育年限 *@
					@Html.LabelFor(e=>e.HumanEducatedYears)
				</td>
				<td class="TD_STYLE2">
					@Html.DropDownListFor(e=>e.HumanEducatedYears,ViewBag.jynx as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>
				<td class="TD_STYLE1">
					@* 学历专业 *@
					@Html.LabelFor(e=>e.HumanEducatedMajor)
				</td>
				<td class="TD_STYLE2">
					@Html.DropDownListFor(e=>e.HumanEducatedMajor,ViewBag.xlzy as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>
				<td class="TD_STYLE1">
					@* 薪酬标准 *@
					@Html.LabelFor(e=>e.DemandSalaryStandard)
				</td>
				<td class="TD_STYLE2">
					@*有下拉效果的属性*@
					@* @Html.DropDownListFor(e=>e.DemandSalaryStandard,ViewBag.xc as IEnumerable<SelectListItem>,new{@class="form-control"}) *@
					<select v-model="newsalarySun" v-on:change="handleChange2" class="form-control">
						@foreach (var item in ViewBag.xc as IEnumerable<SelectListItem>)
						{
							<option value="@item.Value">@item.Text</option>
						}
					</select>
					
				</td>
				<td class="TD_STYLE1">
					@* 建档时间 *@
					@Html.LabelFor(e=>e.RegistTime)
				</td>
				<td class="TD_STYLE2">
					@* @Html.TextBoxFor(e => e.RegistTime, new { @class = "form-control", @value = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") }) *@
					<input type="text" name="RegistTime" class="form-control" value="@DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")" readonly="readonly" />
				</td>


			</tr>
			<tr>

				<td class="TD_STYLE1">
					@* 特长 *@
					@Html.LabelFor(e=>e.HumanSpeciality)
				</td>
				<td class="TD_STYLE2">
					@Html.DropDownListFor(e=>e.HumanSpeciality,ViewBag.tc as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>
				<td class="TD_STYLE1">
					@* 爱好 *@
					@Html.LabelFor(e=>e.HumanHobby)
				</td>
				<td class="TD_STYLE2">
					@Html.DropDownListFor(e=>e.HumanHobby,ViewBag.ah as IEnumerable<SelectListItem>,new{@class="form-control"})
				</td>

				<td class="TD_STYLE1">
					登记人

				</td>
				<td class="TD_STYLE2">
					<input type="text" name="Register" class="form-control" value="@ViewBag.uname" readonly="readonly" />

				</td>
			</tr>
			<tr>
				<td class="TD_STYLE1">
					@* 个人履历 *@
					@Html.LabelFor(e=>e.HumanHistoryRecords)
				</td>
				<td colspan="7" class="TD_STYLE2">
					@Html.TextAreaFor(e=>e.HumanHistoryRecords,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.HumanHistoryRecords)</span>
				</td>
			</tr>

			<tr>
				<td class="TD_STYLE1">
					@* 备注 *@
					@Html.LabelFor(e=>e.Remark)
				</td>
				<td colspan="7" class="TD_STYLE2">
					@Html.TextAreaFor(e=>e.Remark,new{@class="form-control"})
					<span class="s">@Html.ValidationMessageFor(e=>e.Remark)</span>
				</td>
			</tr>
		</table>
	</form>

	<script>
		new Vue({
			el: '#hfAdd',
			data: {
				list: [],
				value: "",
				options: [],
				firstid: "",
				secondid: "",
				thirdid: "",
				imageUrl: '', /* 文件上传 */
				HumanMajorKindId: '',
				MajorName: [],
				idCard: '',
				birthday: '',
				gender: '',
				age: '',
				money:'',
				kindname:'',
				kindid:'',
				majorid:'',
				majorname:''
			},
			methods: {
				fill() {
					axios.get('/ER/GetFirstKinds').then(res => {
						this.options = res.data.map(item => {
							return {
								value: item.value,
								label: item.label,
								children: item.children
							};
						});
					}).catch(err => {
						console.log(err);
					})
				},
				parseIdCard() {
					if (this.idCard.length === 18) {
						// 解析身份证号获取生日、性别等信息
						var birthday = this.idCard.substring(6, 10) + '-' + this.idCard.substring(10, 12) + '-' + this.idCard.substring(12, 14);
						var genderCode = this.idCard.substring(16, 17);
						var gender = genderCode % 2 === 0 ? '女' : '男';
						var age = new Date().getFullYear() - parseInt(this.idCard.substring(6, 10));

						// 将解析出的信息赋值给对应的Vue数据属性
						this.birthday = birthday;
						this.gender = gender;
						this.age = age;
					} else {
						// 身份证号格式不正确的处理逻辑
					}
				},
				handleChange(value) {
					console.log('值', value);
					if (value != null) {
						this.firstid = value[0];
						this.secondid = value[1];
						this.thirdid = value[2];
					}
				},
				// 文件上传
				handleAvatarSuccess(res, file) {
					this.imageUrl = URL.createObjectURL(file.raw);
				},
				beforeAvatarUpload(file) {
					const isJPG = file.type === 'image/jpeg';
					const isLt2M = file.size / 1024 / 1024 < 2;

					if (!isJPG) {
						this.$message.error('上传头像图片只能是 JPG 格式!');
					}
					if (!isLt2M) {
						this.$message.error('上传头像图片大小不能超过 2MB!');
					}
					return isJPG && isLt2M;
				},
				getName: function () {
					axios.get('/ER/GetNames', {
						params: {
							id: this.HumanMajorKindId
						}
					}).then(res => {
						this.MajorName = res.data;
					}).catch(err => {
						console.log(err);
					})
				},
				handleChange2() {
					axios.get('/MC/GetSSNameById', {
						params: {
							salayid: this.newsalarySun
						}
					}).then(res => {
						
						this.money = res.data.salarySum;
					}).catch(err => {
						console.log(err);
					})
				},
				tc: function () {
					axios.get("/ER/EMRById").then(res => {
						this.kindname = res.data.majorKindName;
						this.kindid = res.data.majorKindId;
						this.majorid = res.data.majorId;
						this.majorname = res.data.majorName;
					}).catch(err => {
						console.log(err);
					});
				},
			},

			mounted: function () {
				this.fill();
				this.tc();
			}
		})
	</script>


</body>
</html>